#-*-perl-*-
use lib '../lib';
use Test::More qw(no_plan);
use strict;
use warnings;

use_ok 'AlienArena::Server::CVar::DMFlags';
my $dmflags = AlienArena::Server::CVar::DMFlags->new();
isa_ok($dmflags,'AlienArena::Server::CVar::DMFlags');
isa_ok($dmflags,'AlienArena::Server::CVar');

$dmflags->value(0x00001000+0x00100000+0x0020);
is_deeply([$dmflags->flag_list], [qw(same_level allow_exit bots)], "flag list");

ok $dmflags->set_flags(qw(quadfire_drop botchat skinteams)), "set some flags";
my @flags = $dmflags->flag_list;
ok grep(/quadfire_drop/, @flags), "found quadfire_drop";
ok grep(/botchat/, @flags), "found botchat";
ok grep(/skinteams/, @flags), "found bot";

is $dmflags->value, 0x00001000+0x00100000+0x0020+0x0040+0x00010000+0x00040000, "value correct";

ok $dmflags->clear_flags(qw( quadfire_drop same_level no_armor )), "clear some flags";

is $dmflags->value, 0x00001000+0x00100000+0x0040+0x00040000, "value correct";
